package training.sample.app.repository.impl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import training.sample.app.domain.Client;
import training.sample.app.repository.ClientDao;
import training.sample.app.repository.base.AbstractHibernateDao;

@Repository
public class ClientRepository extends AbstractHibernateDao<Client, Long> implements ClientDao {
	
	@Override
	public Client findById(Long clientId) {
		Criteria cr = getSession()
				.createCriteria(Client.class, "client")
				.add(Restrictions.eq("id", clientId));
		return (Client) cr.uniqueResult();
	}
	
}

